/* $Header: run_ui.h,v 2.2 01/10/02 10:30:38 przybyls Exp $ */

/***********************************************************************/
/* INCLUDE FILE NAME:  run_ui.h                                        */
/* ==================                                                  */
/*                                                                     */
/* Author:  Lesley                                                     */
/*                                                                     */
/* COMMENT:                                                            */
/*                                                                     */
/*    run control prototypes and definitions                           */
/*                                                                     */
/*                                                                     */
/***********************************************************************/

#ifndef RUNUI_H
#define RUNUI_H

/*--------begin change by wangwei----------*/
#include <error.h>
#include <status.h>
/*--------end change----------------------*/
/*****************************/
/*   IFDEFS                  */
/*****************************/


/*****************************/
/*   GLOBAL VARIABLES        */
/*****************************/

extern INT32 Last_Run_Time;

/*****************************/
/*   MACROS                  */
/*****************************/


/*****************************/
/*   TYPEDEFS                */
/*****************************/

typedef enum
{
        EndOvenRamp,
        EndPostTime,
        Abort
} STOP_RUN_REASON;

typedef enum
{
        Manual,
        Auto
} INVOCATION_MODE;

/*****************************/
/*   FUNCTION PROTOTYPES     */
/*****************************/
/*--------begin change by wangwei----------*/
/* run_task.c */
extern void RunTask ( void );
/*--------end change----------------------*/
/* run_state.c */
void InitializeRunControl( void );
#pragma SECTION PROG=SysCode
BIT8 StartRun( void );
#pragma SECTION UNDO
void Prepare ( INVOCATION_MODE mode );
void StopRun( STOP_RUN_REASON reason );
void BlankRun( void );
void SccRun( void );
void SccPreRun( void );
UI_ERR SetRunState( INT32 state, INT16 abort );

/* run_ui.c */
BIT8 RunInProgress( void );
BIT8 RunInProgressOrPending( void );
BIT8 RunActiveOrPostTime( void );
BIT8 RunActivePendingOrPost( void );
TIME_SETPT GetRunLength( void );
TIME_SETPT GetRunTime( void );
TIME_SETPT GetLastRunTime ( void );
BIT8 InPostTime ( void );
TIME_SETPT PostTimeRemaining ( void );
BIT8 NotRunIdle( void );
ON_OFF GetAutoPrepRun( void );
UI_ERR SetAutoPrepRun( ON_OFF state );
UI_ERR SetControlledByHost( INT32 mode );

/* apg_bus.c */
void InitializeApgBus( void );
void AssertApgPrepare ( void );
void AssertApgStartRequest ( void );
void AssertApgStart ( void );
void AssertApgStop ( void );
void WriteApgBus ( void );
void ApgBusDriver ( void );
INT32 ApgReady ( void );
INT32 ApgValue (void);

#endif
